package com.zty.xiaomi.server.Controller;

import com.zty.xiaomi.server.Vo.ResponseVO;
import com.zty.xiaomi.server.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Losca
 * @date 2022/2/21 19:20
 */
@CrossOrigin
@RestController
@RequestMapping("/file")
public class FileController {
    @Autowired
    FileUtil fileUtil;
    @PostMapping("/upload")
    public ResponseVO<String> upload(@RequestPart("file") MultipartFile file, @RequestParam("bucket") String bucket) throws Exception {
        return ResponseVO.success("", fileUtil.uploadToMinio(file,bucket));
    }
}
